<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
//强大的路由文件


Route::get('/', function () {
    return view('welcome');
});

//NotFoundHttpException in RouteCollection.php line 161:
//错误:404  未找到,路径和路由不匹配,在路由文件没有找到相对应的路由

Route::get('/love',function(){
	echo 'love';
});

//MethodNotAllowedHttpException in RouteCollection.php line 218:
//请求方法不正确,应该按照路由的要求来请求,Route::get  get请求  Route::post post请求

//TokenMismatchException in VerifyCsrfToken.php line 53:
//当前这个错误信息:是因为laravel中 csrf_token 保护机制 防止跨站攻击
//所有的post请求 必须 携带 _token 字段(数据)

//临时关闭csrf保护  在routes.php 文件的同级目录中 Kernel.php 找到 \App\Http\Middleware\VerifyCsrfToken::class,  注释调
Route::post('/like',function(){
	echo 'like';
});

// 为多重动作注册路由 可以让定义多种请求方式
Route::match(['get', 'post'], '/test', function () {
    return 'Hello World';
});

//带参数的路由
Route::get('/delete/{id}/{name}',function($id,$name){
    echo '删除用户id:'.$id.$name;
})->where('id','\d+');

//经过路由访问控制器中的方法
// Route::get('/user/index','Admin\UserController@index');
// Route::get('/user/del/{id}','Admin\UserController@del');
// Route::get('/user/add','Admin\UserController@add');

//注册资源化路由
Route::resource('/admin/goods','Admin\GoodsController');

//隐式控制器路由
Route::controller('/admin/user','Admin\UserController');